import React from 'react'
import { MainLayout } from '../components'

export interface RouterRawState {
  path: string
  element?: JSX.Element
  meta: {
    title: string
    hidden?: boolean
    roles?: string[]
  }
  children?: RouterRawState[]
}

const Home = React.lazy(() => import('../views/home'))
const Login = React.lazy(() => import('../views/login'))
const UserManage = React.lazy(() => import('../views/userManage'))
const UserAdd = React.lazy(() => import('../views/userAdd'))
const Other = React.lazy(() => import('../views/other'))
const Set = React.lazy(() => import('../views/set'))

export const Routes_List: RouterRawState[] = [{
  path: '/',
  element: <MainLayout><Home /></MainLayout>,
  meta: {
    title: '首页'
  }
}, {
  path: '/login',
  element: <Login></Login>,
  meta: {
    title: '登录',
    hidden: true
  }
}, {
  path: '/user',
  meta: {
    title: '用户管理',
    roles: ['admin', 'test']
  },
  children: [{
    path: '/user/manage',
    element: <MainLayout><UserManage></UserManage></MainLayout>,
    meta: {
      title: '用户管理',
      roles: ['admin']
    }
  }, {
    path: '/user/add',
    element: <MainLayout><UserAdd></UserAdd></MainLayout>,
    meta: {
      title: "用户添加"
    }
  }]
}, {
  path: '/other',
  element: <MainLayout><Other></Other></MainLayout>,
  meta: {
    title: '其他'
  }
}, {
  path: '/set',
  element: <MainLayout><Set></Set></MainLayout>,
  meta: {
    title: '设置'
  }
}]